<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <style>
        .component-fade-enter-active,
        .component-fade-leave-active {
            transition: opacity 0.3s ease;
        }

        .component-fade-enter-from,
        .component-fade-leave-to {
            opacity: 0;
        }

        .demo {
            font-family: sans-serif;
            border: 1px solid #eee;
            border-radius: 2px;
            padding: 20px 30px;
            margin-top: 1em;
            margin-bottom: 40px;
            user-select: none;
            overflow-x: auto;
        }
    </style>
    <script src='./vue.global.js'></script>
</head>

<body>
    <div id="demo" class="demo">
        <input v-model="view" type="radio" value="v-a" id="a"><label for="a">A</label>
        <input v-model="view" type="radio" value="v-b" id="b"><label for="b">B</label>
        
        <transition name="component-fade" mode="out-in">
            <component :is="view"></component>
        </transition>
    </div>
    <script>
        const Demo = {
            data() {
                return {
                    view: "v-a"
                };
            },
            components: {
                "v-a": {
                    template: "<div>Component A</div>"
                },
                "v-b": {
                    template: "<div>Component B</div>"
                }
            }
        };

        Vue.createApp(Demo).mount("#demo");

    </script>
</body>

</html>